﻿/******************************************************************************
 
 * 文件名称: UIHeaderAsideMainFrame.cs
 * 文件说明: 页面框架(Header-Aside-Main)
 * 当前版本: V2.2
 * 创建日期: 2020-05-05
 *
 * 2020-05-05: V2.2.5 页面框架(Header-Aside-Main)
******************************************************************************/

using System.Drawing;
using System.Windows.Forms;

namespace Bojay.UI
{
    public partial class UIHeaderAsideMainFrameEx : UIHeaderMainFrame
    {
        public UIHeaderAsideMainFrameEx()
        {
            InitializeComponent();
            Controls.SetChildIndex(MainTabControl, 0);
            Header.Parent = this;
            //Aside.Parent = this;
            MainTabControl.Parent = this;
            //Aside.BringToFront();
            //MainTabControl.BringToFront();
            Aside.TabControl = MainTabControl;

            txtAsideTitle.ForeColor = Color.FromArgb(255, 255, 255);
            Aside.ExpandChange += Aside_ExpandChange;

            if (Style == UIStyle.Office2019Blue)
            {
                txtAsideTitle.FillColor = UIColor.Office2019Blue;
                txtAsideTitle.ForeColor = UIColor.LightBlue;
            }
        }

        private void Aside_ExpandChange(bool isExpand)
        {
            if (isExpand)
            {
                pnlAside.Width = Aside.ExpandWidth;
            }
            else
            {
                pnlAside.Width = Aside.CollapseWidth;
            }
        }

        public override void SelectPage(int pageIndex)
        {
            base.SelectPage(pageIndex);
            TreeNode node = Aside.GetTreeNode(pageIndex);
            if (node != null) Aside.SelectedNode = node;
        }

        private void btnExpand_Click(object sender, System.EventArgs e)
        {
            Aside.Expand = !Aside.Expand;
        }
    }
}